<?php
/*
Template Name: Contact Us

*/
get_header(); ?>
		
		<div id="primary" class="hfeed">

			<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
					<?php if ( is_front_page() ) { ?>
						<h2 class="entry-title"><?php the_title(); ?></h2>
					<?php } else { ?>	
						<h1 class="entry-title"><?php the_title(); ?></h1>
					<?php } ?>				

					<div class="entry-content">
						<?php the_content(); ?>
						<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', '1095' ), 'after' => '</div>' ) ); ?>
						<?php edit_post_link( __( 'Edit', '1095' ), '<br /><span class="edit-link">', '</span>' ); ?>
                        
                    If you have a question or comment regarding distribution, sales & advertising or interning/contributing to Campus, please fill up the form below and select the appropriate department. We will tend to your message as soon as possible.<br /><br />
                        <h3><strong>Campus Magazine</strong></h3>
                        
                        <strong>WE HAVE MOVED </strong><br />
                        ASKM Pte Ltd<br />
                        242A River Valley Road<br />
                  Singapore 238299<br /><br />
                    Phone: +65  6732 0325<br /><br />
                        
                        <h3>
                            
                           <!-- <a href="http://69.89.31.195/~darmoper/campuscom/wp-content/uploads/2011/08/Directions-to-Campus-Magazine.pdf" target="_blank">Click Here for Directions to our Office</a>
                        -->
                        <a class="click_maps fancybox.iframe" href="<?php  print get_site_url().'/maps'; ?>">Click Here for Directions to our Office</a>  
                        
                        
                      
                     
                            
                      
                       <script type="text/javascript">
                       
                        jQuery(document).ready(function(data)
                    {
                      //  $(".fancybox").fancybox();
                      //jQuery('#map_canvas').hide();
                      
                        
                         jQuery('.click_maps').fancybox({
                     maxWidth	: 900,
		maxHeight	: 500,
		fitToView	: false,
		width		: '70%',
		height		: '70%',
		autoSize	: false,
		closeClick	: false,
		openEffect	: 'none',
		closeEffect	: 'none'
               
	                });
                        
                      
                        
                    })
                        
               
           </script>   
                  
                        
                        </h3>
                        
                        <br /><br />
                   	  <h1>GET IN TOUCH WITH US!</h1>
                        
                        *(denotes required field)<br /><br />
                        <?php
                        //send email php code here
                        $captcha	= new Recaptcha();
                                                                $captcha->publicKey		= "6LfOfuESAAAAAAdwUYKBb0AoN47o3YUNViJ0KOSO";
                                                                $captcha->privateKey	=	"6LfOfuESAAAAABWXUT8g6hDDTtIBXE9TJ8nZwD0w";
                                                      
                        if( $_POST['btnSubmit'] ){
                            
                        //    var_dump($_POST);
                     //       die;
                            
							if( $_POST['contactname']!='' && $_POST['email']!='' && $_POST['message']!='' ){
								$to = $_POST['contactperson'];
								$subject = "Enquiry from ". $_POST['contactname'];
								$message = $_POST['message'];
								$from = $_POST['email'];
								$headers = "Reply-To: ".$_POST['email'];
							
                                                             //   var_dump($to,$subject,$message,$from);
                                                              //  die;
                                                                
                                                                 
                                                                $captcha->checkCaptcha();
                                                                $debug	= $captcha->getError();
                                                              
                                                                
                                                                if(!$debug){
                                                          
                                                                    if( mail($to,$subject,$message,$headers)) {
								 	echo '<span class="text-highlight">Thanks for your email!</span><br><br>';
                                                                    }  else {
                                                                
                                                                        echo '<span class="text-highlight">Fail to send enquiry. Please try again!</span><br><br>';
                                                                    }
                                                                    
                                                                    
                                                                    }
                                                                    
                                                                else{
                                                        	echo '<span class="text-highlight">Wrong Captcha !</span><br><br>';
							
                                                                    }
                                                                
                                                              
                                                                  }  else {
                                                                  
                                                                      		echo '<span class="text-highlight">You must fill up all * fields!</span><br><br>';
						
                                                                  }
                                                                 
						}
                        ?>
                        <form method="POST" action="">
							<h3>Subject:*</h3>
							<select name="contactperson" size="1"> 
			                      <option value="kelly@campus.com.sg">General Enquiry</option> 
                            <option value="kelly@campus.com.sg">Distribution</option>
			             					<option value="aaron@campus.com.sg">Sales & Advertising</option>
                            <option value="interns@campus.com.sg">Internship/Contributor</option>  	   								 
                               					 
							</select>
							<br /><br />
							<h3>Name:*</h3>
							<input id="contactname" type="text" name="contactname" size="70" />
							<br /><br />
							<h3>E-Mail Address:*</h3>
							<input id="email" type="text" name="email" size="70" />
							<br /><br />
                                                        <h3>Message:*</h3>
							<textarea id="message" name="message" cols="67"></textarea>
							<br /><br />
                                                        <?php 
                                                        echo $captcha->getCaptcha();
                                                        ?>
                                                        <br /><br />
                                                        
							<input id="button" type="submit" name="btnSubmit" value="Submit" />
                        </form>
					</div><!-- .entry-content -->
				</div><!-- #post-## -->

			<?php endwhile; ?>

		</div><!--END #primary .hfeed-->
			
<?php get_footer(); ?>
